﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <link href="../../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <link href="../../../Scripts/easyUI145/themes/icon.css" rel="stylesheet" type="text/css" />
    <link href="../../../Scripts/easyUI145/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <script src="../../../Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="../../../Scripts/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../../Scripts/QueryString.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../../Comm/Gener.js"></script>
    <script src="DDLBar.js" type="text/javascript"></script>
    <script src="../../CCFlowEnum.js" type="text/javascript"></script>
    <script src="../../../Scripts/EasyUIUtility.js" type="text/javascript"></script>
    <script src="../../../Scripts/vue.js"></script>
    <!-- 自己的系统风格统一. -->
    <link href="../../../Style/skin/adminfont/iconfont.css" rel="stylesheet" />
    <link href="../../../Style/skin/css/Default.css" rel="stylesheet" />
    <!-- 自己的系统风格统一end -->
</head>
<body>
    <div id="App">
        <!--<model-component></model-component>-->
        <div id="bar">
        </div>
        <fieldset>
            <legend>人员身份规则</legend>
            <ul>
                <li style="list-style:none">
                    <input type="radio" value="0" id="SF_0"  v-model="SF" checked="checked" /> <label style="font-weight:bolder" for="SF_0"> 当前人员的身份（默认）</label>
                    <ol class="olText">
                        <li>说明：就是上一步发送作为当前节点的人员身份。 </li>
                    </ol>

                    <input type="radio" value="1" id="SF_1" v-model="SF" /> <label style="font-weight:bolder" for="SF_1"> 指定节点的人员身份</label>
                    <ol class="olText">
                        <li> 说明：指定节点发送人的作为当前节点的人员身份。 </li>
                        <li>请选择节点:
                            <select id="DDL_Nodes" v-model="node">
                                <option v-for="option in nodes" :value="option.NodeID">{{option.Name}}</option>
                            </select>
                        </li>
                    </ol>
                    <input type="radio" value="2" id="SF_2" v-model="SF" /> <label style="font-weight:bolder" for="SF_2"> 按表单字段作为人员身份（该字段里存储的是账号）</label>
                    <ol class="olText">
                        <li> 说明：指定表单字段作为人员编号作为当前节点的人员身份，比如：我替别人请假，请假人字段作为人员身份。 </li>
                        <li>请选择字段:
                            <select id="DDL_Fields" v-model="field">
                                <option v-for="option in fields" :value="option.KeyOfEn">{{option.Name}}</option>
                            </select>
                        </li>
                    </ol>
                </li>
            </ul>
        </fieldset>
        <fieldset>
            <legend>绑定岗位</legend>
            <ul>
                <li><a href="javascript:OpenDot2DotStations();Save();">绑定岗位-分组模式</a> </li>
                <li><a href="javascript:OpenBranchesAndLeafStations();Save();">绑定岗位-左右树结构模式</a> </li>
            </ul>
        </fieldset>

        <fieldset>
            <legend>已经绑定的岗位</legend>
            <div id="stas">

                <ul>
                    <li v-show="stas.length===0">未设置</li>
                    <template v-for="sta in stas">
                        <li v-show="sta.FK_StationText!=undefined">  <img src="../../../Img/Author.gif" />  {{sta.FK_StationText}}</li>
                    </template>
                </ul>
            </div>
        </fieldset>
        <fieldset>
        <legend>岗位计算方式:</legend>
        <ul>
            <li>
                <select name="DDL_StationReqEmpsWay" id="DDL_StationReqEmpsWay" v-model="StationReqEmpsWay">
                    <option value="0">岗位集合模式</option>
                    <option value="1">岗位切片-严谨模式</option>
                    <option value="2">岗位切片-宽泛模式</option>
                </select>
            </li>
        </ul>
        </fieldset>
       <fieldset>
            <legend>岗位找人规则:</legend>
            <ul>
                <li>
                    <select name="DDL_StationFindWay" id="DDL_StationFindWay" v-model="StationFindWay">
                        <option value="0">递归父级,父级平级寻找</option>
                        <option value="1">递归父级寻找</option>
                    </select>
                </li>
            </ul>
        </fieldset>
        <fieldset>            
			<legend>找人算法</legend>
            <ul>
                <li>第0步：首先从本级部门内的人员寻找，该节点绑定的岗位，如果找不到人就进入下一步寻找。 </li>
                <li>第1步：直线上级寻找，一直查询到根节点，如果找不到人就进入下一步寻找。 </li>
                <li>第2步：直线上级的平级部门寻找，一直查询到根节点，如果找不到人就进入下一步寻找。 </li>
                <li>第3步：当前部门的下一级所有的部门寻找。</li>
                <li>第4步：查找全局岗位人员。</li>
            </ul>
        </fieldset>
        <fieldset>
            <legend>什么是人员身份?</legend>
            <ul>
                <li> 就是按照那个人员来计算当前节点的接受人规则，默认是谁操作的按照谁的身份计算。 </li>
                <li> 比如：我要请假，找部门负责人，就按照当前操作员的身份计算。 </li>

                <li> 有的环境下并不是按照当前人员计算。 </li>
                <li> 比如：我要为别人（非同一部门）请假，找部门负责人，要按照指定的字段（该字段就是请假人员的账号）作为人员身份。 </li>

            </ul>
            <legend>场景一流程图</legend>
            <ul>
                <li>说明:当不同部门申请后,第三个节点接收人为相应部门负责人时.</li>
            </ul>
            <img src="./Img/ShengqingFlow1.png" />
            <legend>场景一配置图</legend>
            <img src="./Img/ShengqingPeizhi1.png" />
            <legend>场景二流程图</legend>
            <ul>
                <li>说明:当申请人为其他部门人员请假时，审批人员为其他部门负责人.</li>
            </ul>
            <img src="./Img/ShengqingFlow2.png" />
            <legend>场景一配置图</legend>
            <img src="./Img/ShengqingBiaodan2.png" />
            <legend>场景一配置图</legend>
            <img src="./Img/ShengqingPeizhi2.png" />
        </fieldset>
    </div>
    <script type="text/javascript">
        var Baseinfo = new Vue({
            el: '#App',
            data: {
                adminModel: 1,
                orgModel: 0,
                stas: [],
                nodes: [],//指定节点
                fields: [],//指定的字段
                SF: 0,
                node: "",
                field:"",
                webuser: null,
                deliverWay: DeliveryWay.ByStation,
                StationReqEmpsWay:0,
 				StationFindWay:0
            },
            methods: {
                OpenDot2DotStations: function () {
                    OpenDot2DotStations();
                    Save();
                },
                OpenNew: function () {
                    var nodeID = GetQueryString("FK_Node");
                    var url = "../../../Comm/RefFunc/BranchesAndLeaf.htm?EnName=BP.WF.Template.NodeSheet&Dot2DotEnsName=BP.WF.Template.NodeStations&Dot2DotEnName=BP.WF.Template.NodeStation&AttrOfOneInMM=FK_Node&AttrOfMInMM=FK_Station&EnsOfM=BP.Port.Stations&DefaultGroupAttrKey=FK_StationType&NodeID=" + nodeID + "&PKVal=" + nodeID;
                    OpenEasyUiDialogExtCloseFunc(url, '设置岗位', 800, 500, function () {
                        Baseinfo.stas = getStas();
                        Save();
                    });
                },
                SetGroupStations: function () {
                    OpenNodStationGroup(this.webuser.GroupNo);

                },
                SetOrgStations: function () {
                    OpenNodStationGroup(this.webuser.OrgNo);
                }
            },
            created() {
                InitBar(this.deliverWay);
                this.stas = getStas();
                var nodeID = GetQueryString("FK_Node");
                var node = new Entity("BP.WF.Node", nodeID);

                var flowNo = node.FK_Flow; 

               
                //绑定节点s
                var nodes = new Entities("BP.WF.Nodes");
                nodes.Retrieve("FK_Flow", flowNo);
                this.nodes = $.grep(nodes, function (obj, i) {
                    return obj.NodeID != undefined
                });

                //绑定字段s
                var flowID = parseInt(flowNo);

                var ens = new Entities("BP.Sys.MapAttrs");
                if (node.FormType == 11)
                    ens.Retrieve("FK_MapData", node.NodeFrmID);
                else
                    ens.Retrieve("FK_MapData", "ND" + flowID + "Rpt");
                this.fields = $.grep(ens, function (obj, i) {
                    return obj.MyPK != undefined
                });

                //设置选择的Model.
                this.SF = node.GetPara("ShenFenModel");
                this.SF = this.SF == null || this.SF == undefined || this.SF == "" ? 0 : this.SF;
                this.node = node.GetPara("ShenFenVal");
                this.field = node.GetPara("ShenFenVal");

                //根据用户的信息，判断是否启用那个设置工具。
                this.webuser = new WebUser();
                this.adminModel = this.webuser.No == "admin" ? 1 : 0;
                this.orgModel = this.webuser.No == "admin" ? 0 : 1;
                //岗位计算模式.
                var val = node.GetPara('StationReqEmpsWay');
                this.StationReqEmpsWay = val;
 				val = node.GetPara('StationFindWay') || "0";
                this.StationFindWay = parseInt(val);
            }
        });

        function OpenNodStationGroup(orgNo) {
            var url = "NodeStationGroup.htm?OrgNo=" + orgNo + "&FK_Node=" + GetQueryString("FK_Node");
            OpenEasyUiDialogExtCloseFunc(url, '绑定岗位', 500, 600, function () {
                Baseinfo.stas = getStas();
            });
        }

        //保存
        function Save() {
            var nodeID = GetQueryString("FK_Node");
            var node = new Entity("BP.WF.Template.NodeExt", nodeID);
            if (Baseinfo.SF == 1) {
                node.SetPara("ShenFenVal", Baseinfo.node);
            }

            //如果按照字段.
            if (Baseinfo.SF == 2) {
                node.SetPara("ShenFenVal", Baseinfo.field);
            }
            node.SetPara("ShenFenModel", Baseinfo.SF);
            node.DeliveryWay = Baseinfo.deliverWay;
            node.SetPara('StationReqEmpsWay', Baseinfo.StationReqEmpsWay);
            node.Update();
        }
    </script>
</body>
</html>
